{
 "cells": [
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "import k3d\n",
    "import math\n",
    "import numpy as np"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "a = 1.5\n",
    "b = -1.8\n",
    "c = 1.6\n",
    "d = 0.9 \n",
    "\n",
    "N = int(1e4)\n",
    "\n",
    "points = np.zeros(N * 3, dtype=np.float32)\n",
    "opacities = np.zeros(N, dtype=np.float32)\n",
    "\n",
    "x = 0\n",
    "y = 0\n",
    "z = 0\n",
    "\n",
    "for i in range(N):\n",
    "    xn = math.sin(a * y) + c * math.cos(a * x)\n",
    "    yn = math.sin(b * x) + d * math.cos(b * y)\n",
    "    zn = math.sin(1.4 * (x + z))\n",
    "\n",
    "    points[i * 3] = xn\n",
    "    points[i * 3 + 1] = yn\n",
    "    points[i * 3 + 2] = zn\n",
    "    opacities[i] = math.sqrt(xn**2 + yn **2 + zn**2) / 2.0\n",
    "\n",
    "    x = xn\n",
    "    y = yn\n",
    "    z = zn"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "plot = k3d.plot(grid_visible=False)\n",
    "\n",
    "attractor = k3d.points(points, shader='flat', point_size=0.025, opacities=opacities, color=0xff0000)\n",
    "plot += attractor\n",
    "\n",
    "plot.display()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "plot.camera = [1.2087724338464674,\n",
    " -3.925551046947802,\n",
    " 3.0224265367721834,\n",
    " 4.839897155761719e-05,\n",
    " -0.0013092756271362305,\n",
    " 5.960464477539063e-08,\n",
    " -0.2389032891647861,\n",
    " 0.49697458858090343,\n",
    " 0.8342310691475641]"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": []
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.8.5"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 2
}
